﻿using System;
using Iesi.Collections.Generic;
using NHibernate.Validator.Constraints;
using TestBat.IModels.Domain;
using TestBat.Models.Validators;

namespace TestBat.Models.Domain
{
    [ScheduleDateRange]
    public class Schedule : DomainEntity, ISchedule
    {
        public Schedule()
            : base()
        {
            Tests = new HashedSet<ITest>();
            Tasks = new HashedSet<IScheduleTask>();
            TraineeGroups = new HashedSet<IScheduleTraineeGroup>();
        }

        [NotNullNotEmpty]
        [Length(255)]
        public virtual string Name { get; set; }

        public virtual bool Active { get; set; }

        [NotNull]
        [Length(99999)]
        public virtual string Introduction { get; set; }

        [NotNull]
        public virtual DateTime Start { get; set; }

        [NotNull]
        public virtual DateTime End { get; set; }

        [NotNull]
        public virtual TimeSpan Time { get; set; }

        public virtual ISet<ITest> Tests { get; private set; }

        public virtual ISet<IScheduleTask> Tasks { get; private set; }

        public virtual ISet<IScheduleTraineeGroup> TraineeGroups { get; private set; }
    }
}
